package com.example.bookkeepingelf.business.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.example.bookkeepingelf.R;

import java.util.List;

public class HomeBillItemRecyclerViewInnerAdapter extends RecyclerView.Adapter<HomeBillItemRecyclerViewInnerAdapter.HomeBillItemViewHolder> {

    private Context context;

    private LayoutInflater layoutInflater;
    private List<String> billFlowDayVos;


    public HomeBillItemRecyclerViewInnerAdapter(Context context, List<String> billFlowDayVos) {
        this.context = context;
        this.billFlowDayVos = billFlowDayVos;
        this.layoutInflater = LayoutInflater.from(context);
    }

    @NonNull
    @Override
    public HomeBillItemViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = layoutInflater.inflate(R.layout.bill_flow_tiem, parent, false);
        return new HomeBillItemViewHolder(view, this);
    }

    @Override
    public void onBindViewHolder(@NonNull HomeBillItemViewHolder holder, int position) {
        String s = this.billFlowDayVos.get(position);
        ImageView bfiDateTextView = holder.bftIconImageView;
        TextView bfiWeekTextView = holder.bftNameTextView;
        TextView bfiIncomeTextView = holder.bftAmountTextView;

        bfiDateTextView.setImageResource(R.drawable.z_tb_gongjiao_1);
        bfiWeekTextView.setText(s);
        bfiIncomeTextView.setText("222.22");
    }

    @Override
    public int getItemCount() {
        return billFlowDayVos.size();
    }

    public static class HomeBillItemViewHolder extends RecyclerView.ViewHolder {


        ImageView bftIconImageView;
        TextView bftNameTextView;

        TextView bftAmountTextView;




        public HomeBillItemViewHolder(@NonNull View itemView, HomeBillItemRecyclerViewInnerAdapter homeBillDayRecyclerViewAdapter) {
            super(itemView);
            this.bftIconImageView = itemView.findViewById(R.id.bft_icon_image_view);
            this.bftNameTextView = itemView.findViewById(R.id.bft_name_text_view);
            this.bftAmountTextView = itemView.findViewById(R.id.bft_amount_text_view);

        }

    }

}
